/*
 * Bricks-OS, Operating System for Game Consoles
 * Copyright (C) 2009 Maximus32 <Maximus32@bricks-os.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307 USA
 */


#include "mathlib.h"
#include "math.h"



namespace mathlib
{


const float log2Table[LOG2_TABLE_SIZE] =
{
  0,
  0.02236781302845450986,
  0.044394119358453436319,
  0.06608919045777243706,
  0.087462841250339401489,
  0.10852445677816904834,
  0.12928301694496646679,
  0.14974711950468205801,
  0.16992500144231237336,
  0.1898245588800172301,
  0.20945336562894978361,
  0.22881869049588088316,
  0.24792751344358548993,
  0.26678654069490137513,
  0.28540221886224836911,
  0.30378074817710293276,
  0.32192809488736234824,
  0.33985000288462474671,
  0.35755200461808367418,
  0.37503943134692474537,
  0.39231742277876030522,
  0.40939093613770177749,
  0.42626475470209795882,
  0.44294349584872827474,
  0.45943161863729725658,
  0.47573343096639775229,
  0.4918530963296747216,
  0.50779464019869624547,
  0.52356195605701283391,
  0.53915881110803143272,
  0.55458885167763738444,
  0.56985560833094783817,
  0.58496250072115618668,
  0.59991284218712770393,
  0.61470984411520823709,
  0.62935662007960957443,
  0.64385618977472469648,
  0.65821148275179475196,
  0.67242534197149561592,
  0.68650052718321841194,
  0.70043971814109218244,
  0.71424551766612265347,
  0.72792045456319920405,
  0.74146698640114694356,
  0.75488750216346856003,
  0.76818432477692633054,
  0.78135971352465960482,
  0.79441586635010597028,
  0.80735492205760406303,
  0.82017896241518772893,
  0.83289001416474162109,
  0.84549005094437523766,
  0.85798099512757208807,
  0.87036471958340455579,
  0.88264304936184123651,
  0.89481776330794349228,
  0.90689059560851847941,
  0.91886323727459451316,
  0.93073733756288623553,
  0.94251450533923986086,
  0.95419631038687524605,
  0.96578428466208698921,
  0.97727992349991643639,
  0.98868468677216581053,
};

const float exp2Table[EXP2_TABLE_SIZE] =
{
  0.5,
  0.51094857432705831357,
  0.5221368912137068774,
  0.53357020033841184858,
  0.54525386633262884484,
  0.5571933712979462161,
  0.56939431737834578229,
  0.58186242938878873776,
  0.59460355750136051345,
  0.60762367999023447762,
  0.62092890603674200101,
  0.63452547859586660994,
  0.64841977732550482028,
  0.66261832157987066161,
  0.67712777346844632564,
  0.69195494098191601129,
  0.70710678118654757274,
  0.72259040348852332514,
  0.73841307296974967311,
  0.75458221379671142071,
  0.77110541270397037206,
  0.7879904225539432483,
  0.80524516597462714174,
  0.82287773907698247289,
  0.84089641525371450204,
  0.85930964906123896707,
  0.87812608018664972676,
  0.8973545375015535841,
  0.91700404320467121533,
  0.93708381705514998128,
  0.95760328069857370004,
  0.97857206208770008971,
  1,
  1.0218971486541166271,
  1.0442737824274137548,
  1.0671404006768236972,
  1.0905077326652576897,
  1.1143867425958924322,
  1.1387886347566915646,
  1.1637248587775774755,
  1.1892071150027210269,
  1.2152473599804689552,
  1.241857812073484002,
  1.2690509571917332199,
  1.2968395546510096406,
  1.3252366431597413232,
  1.3542555469368926513,
  1.3839098819638320226,
  1.4142135623730951455,
  1.4451808069770466503,
  1.4768261459394993462,
  1.5091644275934228414,
  1.5422108254079407441,
  1.5759808451078864966,
  1.6104903319492542835,
  1.6457554781539649458,
  1.6817928305074290041,
  1.7186192981224779341,
  1.7562521603732994535,
  1.7947090750031071682,
  1.8340080864093424307,
  1.8741676341102999626,
  1.9152065613971474001,
  1.9571441241754001794,
};


}
